<html>
<head><meta charset="utf-8"><title>name::name::name::name::name · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/name.3A.3Aname.3A.3Aname.3A.3Aname.3A.3Aname.html">name::name::name::name::name</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="230869538"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/name%3A%3Aname%3A%3Aname%3A%3Aname%3A%3Aname/near/230869538" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/name.3A.3Aname.3A.3Aname.3A.3Aname.3A.3Aname.html#230869538">(Mar 18 2021 at 14:10)</a>:</h4>
<p>wut <a href="/user_uploads/4715/ZzjRhN_Tz9VuIPc5rIMTxfn6/screenshot-2021-03-18-150932.png">screenshot-2021-03-18-150932.png</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/ZzjRhN_Tz9VuIPc5rIMTxfn6/screenshot-2021-03-18-150932.png" title="screenshot-2021-03-18-150932.png"><img src="/user_uploads/4715/ZzjRhN_Tz9VuIPc5rIMTxfn6/screenshot-2021-03-18-150932.png"></a></div>



<a name="230871070"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/name%3A%3Aname%3A%3Aname%3A%3Aname%3A%3Aname/near/230871070" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/name.3A.3Aname.3A.3Aname.3A.3Aname.3A.3Aname.html#230871070">(Mar 18 2021 at 14:20)</a>:</h4>
<p>why do we get different results for Import and Qualify?</p>



<a name="230871640"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/name%3A%3Aname%3A%3Aname%3A%3Aname%3A%3Aname/near/230871640" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/name.3A.3Aname.3A.3Aname.3A.3Aname.3A.3Aname.html#230871640">(Mar 18 2021 at 14:23)</a>:</h4>
<p>good question</p>



<a name="230871832"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/name%3A%3Aname%3A%3Aname%3A%3Aname%3A%3Aname/near/230871832" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/name.3A.3Aname.3A.3Aname.3A.3Aname.3A.3Aname.html#230871832">(Mar 18 2021 at 14:25)</a>:</h4>
<p>btw, imo "Qualify as cast" is misworded? Yeah it's using <code>as</code>, but <code>&lt;T as Trait&gt;</code> is not really a cast</p>



<a name="230871839"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/name%3A%3Aname%3A%3Aname%3A%3Aname%3A%3Aname/near/230871839" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/name.3A.3Aname.3A.3Aname.3A.3Aname.3A.3Aname.html#230871839">(Mar 18 2021 at 14:25)</a>:</h4>
<p>the long path has 15 segments, which is exactly <code>MAX_PATH_LEN</code></p>



<a name="230871881"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/name%3A%3Aname%3A%3Aname%3A%3Aname%3A%3Aname/near/230871881" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/name.3A.3Aname.3A.3Aname.3A.3Aname.3A.3Aname.html#230871881">(Mar 18 2021 at 14:25)</a>:</h4>
<p>Oh it doesn't actually use <code>as</code></p>



<a name="230871921"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/name%3A%3Aname%3A%3Aname%3A%3Aname%3A%3Aname/near/230871921" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/name.3A.3Aname.3A.3Aname.3A.3Aname.3A.3Aname.html#230871921">(Mar 18 2021 at 14:25)</a>:</h4>
<p>It produces <code>name::AsName::as_name(...)</code></p>



<a name="230871955"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/name%3A%3Aname%3A%3Aname%3A%3Aname%3A%3Aname/near/230871955" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/name.3A.3Aname.3A.3Aname.3A.3Aname.3A.3Aname.html#230871955">(Mar 18 2021 at 14:26)</a>:</h4>
<p>hm yeah right it only uses as if you were calling <code>T::as_name</code> before</p>



<a name="230872055"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/name%3A%3Aname%3A%3Aname%3A%3Aname%3A%3Aname/near/230872055" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/name.3A.3Aname.3A.3Aname.3A.3Aname.3A.3Aname.html#230872055">(Mar 18 2021 at 14:26)</a>:</h4>
<p>anyway, that's just a side point</p>



<a name="230872167"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/name%3A%3Aname%3A%3Aname%3A%3Aname%3A%3Aname/near/230872167" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kirill Bulatov <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/name.3A.3Aname.3A.3Aname.3A.3Aname.3A.3Aname.html#230872167">(Mar 18 2021 at 14:27)</a>:</h4>
<p>How do you even manage to break it? <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>
<p><a href="/user_uploads/4715/QLqSBK_QjeZaJ0aedPn0FPCL/image.png">image.png</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/QLqSBK_QjeZaJ0aedPn0FPCL/image.png" title="image.png"><img src="/user_uploads/4715/QLqSBK_QjeZaJ0aedPn0FPCL/image.png"></a></div>



<a name="230872250"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/name%3A%3Aname%3A%3Aname%3A%3Aname%3A%3Aname/near/230872250" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/name.3A.3Aname.3A.3Aname.3A.3Aname.3A.3Aname.html#230872250">(Mar 18 2021 at 14:27)</a>:</h4>
<p>I feel like rust-analyzer would've been much less successful hadn't we switched  to 16x9 displays <span aria-label="rofl" class="emoji emoji-1f923" role="img" title="rofl">:rofl:</span></p>



<a name="230872376"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/name%3A%3Aname%3A%3Aname%3A%3Aname%3A%3Aname/near/230872376" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/name.3A.3Aname.3A.3Aname.3A.3Aname.3A.3Aname.html#230872376">(Mar 18 2021 at 14:28)</a>:</h4>
<p>hm, that one _also_ has different results for Import and Qualify</p>



<a name="230872455"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/name%3A%3Aname%3A%3Aname%3A%3Aname%3A%3Aname/near/230872455" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/name.3A.3Aname.3A.3Aname.3A.3Aname.3A.3Aname.html#230872455">(Mar 18 2021 at 14:29)</a>:</h4>
<p>of course import and qualify can potentially be different, if there are local imports</p>



<a name="230872462"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/name%3A%3Aname%3A%3Aname%3A%3Aname%3A%3Aname/near/230872462" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kirill Bulatov <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/name.3A.3Aname.3A.3Aname.3A.3Aname.3A.3Aname.html#230872462">(Mar 18 2021 at 14:29)</a>:</h4>
<p>But yeah, the label mismatch is very awkward: we do use the same field to fill the label but even on the "working" example above I see differences.</p>
<p>And since it's the same path to look for imports, it's very odd, as if the index had started to give some non-determined behaviour.<br>
Can be that <code>FxHashMap</code> I've used recently?</p>



<a name="230872622"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/name%3A%3Aname%3A%3Aname%3A%3Aname%3A%3Aname/near/230872622" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kirill Bulatov <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/name.3A.3Aname.3A.3Aname.3A.3Aname.3A.3Aname.html#230872622">(Mar 18 2021 at 14:30)</a>:</h4>
<p>I have to really take a vacation and make some normal proper work in this field, sorry.</p>



<a name="230872648"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/name%3A%3Aname%3A%3Aname%3A%3Aname%3A%3Aname/near/230872648" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/name.3A.3Aname.3A.3Aname.3A.3Aname.3A.3Aname.html#230872648">(Mar 18 2021 at 14:30)</a>:</h4>
<p>so maybe it's related to local def maps? but the qualify ones are actually more correct...</p>



<a name="230873047"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/name%3A%3Aname%3A%3Aname%3A%3Aname%3A%3Aname/near/230873047" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lukas Wirth <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/name.3A.3Aname.3A.3Aname.3A.3Aname.3A.3Aname.html#230873047">(Mar 18 2021 at 14:32)</a>:</h4>
<p>Those two assist don't use exactly the same stuff for lookups</p>



<a name="230873133"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/name%3A%3Aname%3A%3Aname%3A%3Aname%3A%3Aname/near/230873133" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lukas Wirth <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/name.3A.3Aname.3A.3Aname.3A.3Aname.3A.3Aname.html#230873133">(Mar 18 2021 at 14:32)</a>:</h4>
<p>qualify_path does<br>
<code>let proposed_imports = import_assets.search_for_relative_paths(&amp;ctx.sema);</code><br>
auto_import does<br>
<code>let proposed_imports = import_assets.search_for_imports(&amp;ctx.sema, ctx.config.insert_use.prefix_kind);</code></p>



<a name="230873354"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/name%3A%3Aname%3A%3Aname%3A%3Aname%3A%3Aname/near/230873354" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lukas Wirth <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/name.3A.3Aname.3A.3Aname.3A.3Aname.3A.3Aname.html#230873354">(Mar 18 2021 at 14:34)</a>:</h4>
<p>difference is basically just the prefix so it makes sense that the two return different paths there</p>



<a name="230873933"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/name%3A%3Aname%3A%3Aname%3A%3Aname%3A%3Aname/near/230873933" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lukas Wirth <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/name.3A.3Aname.3A.3Aname.3A.3Aname.3A.3Aname.html#230873933">(Mar 18 2021 at 14:37)</a>:</h4>
<p>If I remember correctly my reasoning for making <code>qualify</code> use relative paths was that the user usually doesn't want fully qualified paths in the middle of their expressions</p>



<a name="230873992"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/name%3A%3Aname%3A%3Aname%3A%3Aname%3A%3Aname/near/230873992" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lukas Wirth <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/name.3A.3Aname.3A.3Aname.3A.3Aname.3A.3Aname.html#230873992">(Mar 18 2021 at 14:37)</a>:</h4>
<p>I also agree the label could be improved</p>



<a name="230874429"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/name%3A%3Aname%3A%3Aname%3A%3Aname%3A%3Aname/near/230874429" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/name.3A.3Aname.3A.3Aname.3A.3Aname.3A.3Aname.html#230874429">(Mar 18 2021 at 14:40)</a>:</h4>
<p><span class="user-mention silent" data-user-id="129457">Florian Diebold</span> <a href="#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/name.3A.3Aname.3A.3Aname.3A.3Aname.3A.3Aname/near/230872648">said</a>:</p>
<blockquote>
<p>so maybe it's related to local def maps? but the qualify ones are actually more correct...</p>
</blockquote>
<p>oh dang it you're right</p>



<a name="230874536"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/name%3A%3Aname%3A%3Aname%3A%3Aname%3A%3Aname/near/230874536" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/name.3A.3Aname.3A.3Aname.3A.3Aname.3A.3Aname.html#230874536">(Mar 18 2021 at 14:40)</a>:</h4>
<p>You can reproduce this by going to <code>builtin_derive.rs</code> and removing the <code>AsName</code> import in the <code>tests</code> module, then trigger autoimport on the <code>as_name()</code> calls below</p>



<a name="230875306"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/name%3A%3Aname%3A%3Aname%3A%3Aname%3A%3Aname/near/230875306" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/name.3A.3Aname.3A.3Aname.3A.3Aname.3A.3Aname.html#230875306">(Mar 18 2021 at 14:45)</a>:</h4>
<p>Ah, the <code>name</code> module has a reexport of itself: <code>pub use crate::name;</code></p>
<p>That must be confusing it</p>



<a name="230875473"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/name%3A%3Aname%3A%3Aname%3A%3Aname%3A%3Aname/near/230875473" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kirill Bulatov <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/name.3A.3Aname.3A.3Aname.3A.3Aname.3A.3Aname.html#230875473">(Mar 18 2021 at 14:46)</a>:</h4>
<p>In the end, the mod path lookup boils down to <a href="https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_def/src/find_path.rs#L94">https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_def/src/find_path.rs#L94</a></p>



<a name="230875822"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/name%3A%3Aname%3A%3Aname%3A%3Aname%3A%3Aname/near/230875822" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kirill Bulatov <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/name.3A.3Aname.3A.3Aname.3A.3Aname.3A.3Aname.html#230875822">(Mar 18 2021 at 14:49)</a>:</h4>
<p>On the ide level, we find all items matching by our search criteria and then for all of them call a higher-level ide method, where specify a few parameters such as prefixes and the module we want this path to be resolved in. <br>
The ide method tosses this around and eventually passes that to the method above, with no significant changes afaik.</p>



<a name="230900439"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/name%3A%3Aname%3A%3Aname%3A%3Aname%3A%3Aname/near/230900439" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Mcnab <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/name.3A.3Aname.3A.3Aname.3A.3Aname.3A.3Aname.html#230900439">(Mar 18 2021 at 16:57)</a>:</h4>
<blockquote>
<p>Ah, the <code>name</code> module has a reexport of itself: <code>pub use crate::name;</code></p>
</blockquote>
<p>The pumping lemma for Rust paths</p>



<a name="230908343"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/name%3A%3Aname%3A%3Aname%3A%3Aname%3A%3Aname/near/230908343" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/name.3A.3Aname.3A.3Aname.3A.3Aname.3A.3Aname.html#230908343">(Mar 18 2021 at 17:43)</a>:</h4>
<p>Hmm, looks like it happens outside of block expressions too: <a href="/user_uploads/4715/xNqCeNIEO4CENigMggU43ldd/screenshot-2021-03-18-184314.png">screenshot-2021-03-18-184314.png</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/xNqCeNIEO4CENigMggU43ldd/screenshot-2021-03-18-184314.png" title="screenshot-2021-03-18-184314.png"><img src="/user_uploads/4715/xNqCeNIEO4CENigMggU43ldd/screenshot-2021-03-18-184314.png"></a></div>



<a name="230947324"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/name%3A%3Aname%3A%3Aname%3A%3Aname%3A%3Aname/near/230947324" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kirill Bulatov <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/name.3A.3Aname.3A.3Aname.3A.3Aname.3A.3Aname.html#230947324">(Mar 18 2021 at 22:29)</a>:</h4>
<p>What does <code>block</code>  mean in <code>ModuleId</code>?</p>
<p>I've looked at what <code>find_local_import_locations</code> function returns and for this case, it returns two ModuleIds, one having a blockId, and the other not. <br>
Module id is defined so</p>
<div class="codehilite"><pre><span></span><code>#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct ModuleId {
    krate: CrateId,
    block: Option&lt;BlockId&gt;,
    pub local_id: LocalModuleId,
}
</code></pre></div>
<p>that due to the blockId difference, these two modules are unequal and there are no existing means to compare ModuleIds differently.</p>
<p>Another weird issue is that I cannot reproduce the bug in all our codebase, including the tests in <code>auto_import.rs</code>, that's all odd.</p>



<a name="230949778"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/name%3A%3Aname%3A%3Aname%3A%3Aname%3A%3Aname/near/230949778" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/name.3A.3Aname.3A.3Aname.3A.3Aname.3A.3Aname.html#230949778">(Mar 18 2021 at 22:57)</a>:</h4>
<p><code>block</code> is <code>Some</code> if the <code>ModuleId</code> refers to a block expression</p>



<a name="230949782"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/name%3A%3Aname%3A%3Aname%3A%3Aname%3A%3Aname/near/230949782" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/name.3A.3Aname.3A.3Aname.3A.3Aname.3A.3Aname.html#230949782">(Mar 18 2021 at 22:57)</a>:</h4>
<p>I'll add some docs</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>